#ifndef PL_PARTICLE_H
#define PL_PARTICLE_H

/*
void
plParticlesActuatorExample(unsigned int id, unsigned int particle, void *user)
{
	float *matrix;
	float *energy;
	void *data;
	
	matrix = plParticlesMatrix(id, particle);
	energy = plParticlesEnergy(id, particle);
	data = plParticlesData(id, particle);

	if((*energy) <= 0.0f)
	{
		// initialize energy
		// initialize matrix
	}
	else
	{
		// stuff on matrix
		// stuff on energy
	}

	// draw on matrix
}
*/

#ifdef JMBC_INSIDE

typedef struct
{
	float matrix[16];
	float energy;
	void *data;
} PLParticle;

typedef struct
{
	unsigned int group;
} PLParticles;

#endif

// Context

void
plParticlesCreateContext(void);

// Generation / Deletion

void
plGenParticles(unsigned int n, unsigned int *particles);

void
plDeleteParticles(unsigned int n, unsigned int *particles);

// Load / Unload

void
plParticlesLoad(unsigned int id, unsigned int n, unsigned int type);

void
plParticlesUnload(unsigned int id);

// Query

unsigned int
plParticlesLength(unsigned int id);

float *
plParticlesEnergy(unsigned int id, unsigned int particle);

float *
plParticlesMatrix(unsigned int id, unsigned int particle);

void *
plParticlesData(unsigned int id, unsigned int particle);

// Operation

void
plParticlesActuatorInitializer(unsigned int id, unsigned int particle, void *user);

void
plParticlesAct(unsigned int id,  void (*actuator)(unsigned int id, unsigned int particle, void *user), void *user);

void
plParticlesDepthSort(unsigned int id);

#endif
